package cn.hubujyjs.lp.exception;

import cn.hubujyjs.lp.utils.R;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 全局异常处理类
 */
@ControllerAdvice
public class GlobalExceptionHandler {
    //自定义异常处理
    @ExceptionHandler(LpException.class)
    @ResponseBody
    public R error(LpException e){
        e.printStackTrace();
        return R.fail(e.getMsg());
    }
}
